<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SqlDataSourcePage.aspx.cs" Inherits="SqlDataSourcePage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
            ConnectionString="<%$ ConnectionStrings:RecruitVietnamDbConnectionString %>"
            DeleteCommand="DELETE FROM [tblJSAccounts] WHERE [UserID] = @original_UserID AND [Email] = @original_Email AND [FirstName] = @original_FirstName AND [LastName] = @original_LastName"
            InsertCommand="INSERT INTO [tblJSAccounts] ([Email], [FirstName], [LastName]) VALUES (@Email, @FirstName, @LastName)"
            OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [UserID], [Email], [FirstName], [LastName] FROM [tblJSAccounts] WHERE ([Activate] = @Activate) ORDER BY [LastLogin] DESC, [RegisterDate] DESC"
            UpdateCommand="UPDATE [tblJSAccounts] SET [Email] = @Email, [FirstName] = @FirstName, [LastName] = @LastName WHERE [UserID] = @original_UserID AND [Email] = @original_Email AND [FirstName] = @original_FirstName AND [LastName] = @original_LastName">
            <DeleteParameters>
                <asp:Parameter Name="original_UserID" Type="Int32" />
                <asp:Parameter Name="original_Email" Type="String" />
                <asp:Parameter Name="original_FirstName" Type="String" />
                <asp:Parameter Name="original_LastName" Type="String" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="FirstName" Type="String" />
                <asp:Parameter Name="LastName" Type="String" />
                <asp:Parameter Name="original_UserID" Type="Int32" />
                <asp:Parameter Name="original_Email" Type="String" />
                <asp:Parameter Name="original_FirstName" Type="String" />
                <asp:Parameter Name="original_LastName" Type="String" />
            </UpdateParameters>
            <SelectParameters>
                <asp:Parameter DefaultValue="True" Name="Activate" Type="Boolean" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="FirstName" Type="String" />
                <asp:Parameter Name="LastName" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
        &nbsp;</div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="UserID"
            DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="UserID" HeaderText="UserID" InsertVisible="False" ReadOnly="True"
                    SortExpression="UserID" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
                <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
            </Columns>
        </asp:GridView>
    </form>
</body>
</html>
